package com.zmx.base.web;

import com.zmx.base.service.BaseService;
import com.zmx.common.common.invocation.InvocationInfoProxy;
import com.zmx.common.common.utils.SignUtils;
import com.zmx.common.common.web.rest.ResponseResult;
import com.zmx.user.api.MemberApi;
import com.zmx.user.dto.MemberDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: 基础公共服务控制器
 * @ClassName: BaseController
 * @Author zhaomxr
 * @Date 2022-01-11 16:06
 */
@Api("基础公共服务")
@Slf4j
@RestController
@RequestMapping("base")
public class BaseController {

    @Autowired
    private BaseService baseService;

    @ApiOperation(value = "获取签名", tags = "获取签名")
    @GetMapping("getSign")
    public ResponseResult getSign(String timeStamp) {
        String sign = baseService.getSign(timeStamp);
        return ResponseResult.success(sign);
    }

    @ApiOperation(value = "获取客服电话", tags = "获取客服电话")
    @GetMapping(value = "getServicePhone")
    public ResponseResult getServicePhone() {
        log.info("begin to getServicePhone");
        try {
            String phone = baseService.getServicePhone();
            return ResponseResult.success(phone);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            return ResponseResult.fail("获取客服电话失败");
        }
    }
}
